package yxy.game.pm2.module.tip.checker;

import yxy.apple.util.PubSub.MethodSubscriber;
import yxy.apple.util.PubSub.SubscriptionMethod;
import yxy.game.pm2.bean.currency.CurrencyType;
import yxy.game.pm2.bean.pubsub.CurrencyPublisher;
import yxy.game.pm2.bean.pubsub.CurrencyPublisher.CurrencySubscription;
import yxy.game.pm2.module.BlacksmithHandle;
import yxy.game.pm2.module.tip.TipHandle;
import yxy.game.pm2.module.tip.TipType;

public class TipSubscriber_工坊 extends MethodSubscriber {

	static private TipSubscriber_工坊 instance;

	public static TipSubscriber_工坊 getInstance() {
		if (instance == null) {
			instance = new TipSubscriber_工坊();
			instance.init();
		}
		return instance;
	}

	private void init() {
		CurrencyPublisher.getInstance().subscribe(this);
	}

	private TipSubscriber_工坊() {
	}

	@SubscriptionMethod(Type = CurrencySubscription.class)
	public void receive(CurrencySubscription subscription) {
//		System.err.println("订阅更新Item");
		String playerCode = subscription.getPlayerCode();
		if (!subscription.getTypes().contains(CurrencyType.CT_装备)) {
			return;
		}
		boolean open = new BlacksmithHandle().canFusion(playerCode);
		new TipHandle().updateTip(playerCode, TipType.工坊_装备切页, open);
	}

}
